import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
} from '@nestjs/common';
import { TeacherService } from './teacher.service';
import { CreateTeacherDto } from './dto/create-teacher.dto';
import { UpdateTeacherDto } from './dto/update-teacher.dto';
import { ApiTags, ApiOperation, ApiQuery } from '@nestjs/swagger';

@Controller('teacher')
@ApiTags('教师管理')
export class TeacherController {
  constructor(private readonly teacherService: TeacherService) {}

  @Post('add')
  @ApiOperation({ summary: '新增教师' })
  @ApiQuery({ name: 'zzl', description: '123' })
  create(@Body() createTeacherDto: CreateTeacherDto) {
    return this.teacherService.create(createTeacherDto);
  }

  @Get('list')
  @ApiOperation({ summary: '查询教师列表' })
  findAll() {
    return this.teacherService.findAll();
  }

  @Get('get/:id')
  @ApiOperation({ summary: '查询教师单个' })
  findOne(@Param('id') id: string) {
    return this.teacherService.findOne(+id);
  }

  @Post('update')
  @ApiOperation({ summary: '更新教师' })
  update(@Body() updateTeacherDto: UpdateTeacherDto) {
    return this.teacherService.update(updateTeacherDto);
  }

  @Delete('remove/:id')
  @ApiOperation({ summary: '删除教师' })
  remove(@Param('id') id: string) {
    return this.teacherService.remove(+id);
  }
}
